import serial
import time
import psutil

com = serial.Serial('COM6', 9600, timeout=0.2)
time.sleep(5)

while True:
    usage = str(int(psutil.cpu_percent(interval=1))) + '#'
    print(usage)
    com.write(usage.encode(encoding='utf-8'))
    time.sleep(10)
